<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="initial-scale=1.0, user-scalable=no, width=device-width">
  <title>使用EPSG.io搜索重新投影</title>
  <link rel="stylesheet" type="text/css" href="https://cdn.jsdelivr.net/npm/bootstrap@5.2.0/dist/css/bootstrap.min.css"
    crossorigin="anonymous">
  <link rel="stylesheet" type="text/css"
    href="https://cdn.jsdelivr.net/npm/@fortawesome/fontawesome-free@6.1.2/css/fontawesome.min.css"
    crossorigin="anonymous">
  <link rel="stylesheet" type="text/css"
    href="https://cdn.jsdelivr.net/npm/@fortawesome/fontawesome-free@6.1.2/css/solid.css" crossorigin="anonymous">
  <link rel="stylesheet" type="text/css"
    href="https://cdn.jsdelivr.net/npm/@fortawesome/fontawesome-free@6.1.2/css/brands.css" crossorigin="anonymous">
  <link rel="stylesheet" type="text/css" href="./theme/ol.css">
  <link rel="stylesheet" type="text/css" href="/theme/site.css">
  <link rel="icon" type="image/svg+xml" href="/theme/img/logo-light.svg" media="(prefers-color-scheme: light)" />
  <link rel="icon" type="image/svg+xml" href="/theme/img/logo-dark.svg" media="(prefers-color-scheme: dark)" />
</head>

<body>
  <header class="navbar navbar-expand-md navbar-dark mb-3 px-3 py-0 fixed-top" role="navigation">
    <a class="navbar-brand" href="/"><img src="/theme/img/logo-dark.svg" width="70" height="70"
        alt="">&nbsp;OpenLayers</a>
    <button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target="#olmenu"
      aria-controls="olmenu" aria-expanded="false" aria-label="Toggle navigation">
      <span class="navbar-toggler-icon"></span>
    </button>

    <!-- menu items that get hidden below 768px width -->
    <nav class="collapse navbar-collapse" id="olmenu">
      <ul class="nav navbar-nav ms-auto">
        <li class="nav-item dropdown">
          <a class="nav-link dropdown-toggle" href="#" id="docdropdown" role="button" data-bs-toggle="dropdown"
            aria-haspopup="true" aria-expanded="false">Docs</a>
          <div class="dropdown-menu dropdown-menu-end mb-3" aria-labelledby="docdropdown">
            <a class="dropdown-item" href="/doc/">Docs</a>
            <div class="dropdown-divider"></div>
            <a class="dropdown-item" href="/doc/quickstart.html"><i class="fa fa-check fa-fw me-2 fa-lg"></i>快速入门</a>
            <a class="dropdown-item" href="/doc/faq.html"><i class="fa fa-question fa-fw me-2 fa-lg"></i>常见问题</a>
            <a class="dropdown-item" href="/doc/tutorials/"><i class="fa fa-book fa-fw me-2 fa-lg"></i>教程</a>

          </div>
        </li>
        <li class="nav-item"><a class="nav-link" href="/en/latest/examples/">Examples</a></li>
        <li class="nav-item dropdown">
          <a class="nav-link dropdown-toggle" href="#" id="apidropdown" role="button" data-bs-toggle="dropdown"
            aria-haspopup="true" aria-expanded="false">
            <i class="fa fa-sitemap me-1"></i>API
          </a>
          <div class="dropdown-menu dropdown-menu-end mb-3" aria-labelledby="apidropdown">
            <a class="dropdown-item" href="/en/latest/apidoc/"><i class="fa fa-sitemap fa-fw me-2 fa-lg"></i>v8.2.0
              (latest)</a </div>
        </li>
      </ul>
    </nav>
  </header>

  <div class="container-fluid line-numbers">
    <div id="latest-check" class="alert alert-warning alert-dismissible" role="alert" style="display:none">
      <button id="latest-dismiss" type="button" class="btn-close" data-bs-dismiss="alert" aria-label="Close"></button>
      This example uses OpenLayers v<span>8.2.0</span>. The <a id="latest-link" href="#" class="alert-link">latest</a>
      is v<span id="latest-version"></span>.
    </div>


    <div class="row-fluid">
      <a href="#" id="codepen-button" class="btn btn-link float-end">
        <i class="fab fa-codepen fa-lg"></i> Edit
      </a>
      <div class="span12">
        <h4 id="title">使用EPSG.io搜索重新投影</h4>
        <p class="tags">
          <span class="badge-group">
            <a href="./index.html?q=reprojection" class="badge badge-info">reprojection</a><a
              class="badge badge-info tag-modal-toggle" data-bs-toggle="modal" data-bs-target="#tag-example-list"
              data-title="reprojection" data-content="&lt;ul class=&quot;list-group&quot;&gt;
                  &lt;li&gt;&lt;a class=&quot;list-group-item list-group-item-action&quot; href=&quot;./geotiff-reprojection.html&quot;&gt;GeoTIFF Reprojection&lt;/a&gt;
                  &lt;li&gt;&lt;a class=&quot;list-group-item list-group-item-action&quot; href=&quot;./reprojection-image.html&quot;&gt;Image Reprojection&lt;/a&gt;
                  &lt;li&gt;&lt;a class=&quot;list-group-item list-group-item-action&quot; href=&quot;./interpolation.html&quot;&gt;Interpolation&lt;/a&gt;
                  &lt;li&gt;&lt;a class=&quot;list-group-item list-group-item-action&quot; href=&quot;./multiple-cogs.html&quot;&gt;Multiple COG sources&lt;/a&gt;
                  &lt;li&gt;&lt;a class=&quot;list-group-item list-group-item-action&quot; href=&quot;./reprojection-wgs84.html&quot;&gt;OpenStreetMap Reprojection&lt;/a&gt;
                  &lt;li&gt;&lt;a class=&quot;list-group-item list-group-item-action&quot; href=&quot;./scaleline-indiana-east.html&quot;&gt;OpenStreetMap Reprojection with ScaleLine Control&lt;/a&gt;
                  &lt;li&gt;&lt;a class=&quot;list-group-item list-group-item-action&quot; href=&quot;./reprojection.html&quot;&gt;Raster Reprojection&lt;/a&gt;
                  &lt;li&gt;&lt;a class=&quot;list-group-item list-group-item-action active&quot; href=&quot;./reprojection-by-code.html&quot;&gt;Reprojection with EPSG.io Search&lt;/a&gt;
                  &lt;/ul&gt;" tabindex="0">8</a>
          </span>
          <span class="badge-group">
            <a href="./index.html?q=projection" class="badge badge-info">projection</a><a
              class="badge badge-info tag-modal-toggle" data-bs-toggle="modal" data-bs-target="#tag-example-list"
              data-title="projection" data-content="&lt;ul class=&quot;list-group&quot;&gt;
                  &lt;li&gt;&lt;a class=&quot;list-group-item list-group-item-action&quot; href=&quot;./cog-projection.html&quot;&gt;COG with Projection Lookup&lt;/a&gt;
                  &lt;li&gt;&lt;a class=&quot;list-group-item list-group-item-action&quot; href=&quot;./wms-custom-proj.html&quot;&gt;Custom Tiled WMS&lt;/a&gt;
                  &lt;li&gt;&lt;a class=&quot;list-group-item list-group-item-action&quot; href=&quot;./reprojection-image.html&quot;&gt;Image Reprojection&lt;/a&gt;
                  &lt;li&gt;&lt;a class=&quot;list-group-item list-group-item-action&quot; href=&quot;./multiple-cogs.html&quot;&gt;Multiple COG sources&lt;/a&gt;
                  &lt;li&gt;&lt;a class=&quot;list-group-item list-group-item-action&quot; href=&quot;./reprojection-wgs84.html&quot;&gt;OpenStreetMap Reprojection&lt;/a&gt;
                  &lt;li&gt;&lt;a class=&quot;list-group-item list-group-item-action&quot; href=&quot;./scaleline-indiana-east.html&quot;&gt;OpenStreetMap Reprojection with ScaleLine Control&lt;/a&gt;
                  &lt;li&gt;&lt;a class=&quot;list-group-item list-group-item-action&quot; href=&quot;./projection-and-scale.html&quot;&gt;Projection and Scale&lt;/a&gt;
                  &lt;li&gt;&lt;a class=&quot;list-group-item list-group-item-action&quot; href=&quot;./reprojection.html&quot;&gt;Raster Reprojection&lt;/a&gt;
                  &lt;li&gt;&lt;a class=&quot;list-group-item list-group-item-action active&quot; href=&quot;./reprojection-by-code.html&quot;&gt;Reprojection with EPSG.io Search&lt;/a&gt;
                  &lt;li&gt;&lt;a class=&quot;list-group-item list-group-item-action&quot; href=&quot;./wms-image-custom-proj.html&quot;&gt;Single Image WMS with Proj4js&lt;/a&gt;
                  &lt;li&gt;&lt;a class=&quot;list-group-item list-group-item-action&quot; href=&quot;./sphere-mollweide.html&quot;&gt;Sphere Mollweide&lt;/a&gt;
                  &lt;li&gt;&lt;a class=&quot;list-group-item list-group-item-action&quot; href=&quot;./wms-no-proj.html&quot;&gt;WMS without Projection&lt;/a&gt;
                  &lt;li&gt;&lt;a class=&quot;list-group-item list-group-item-action&quot; href=&quot;./zoomify.html&quot;&gt;Zoomify&lt;/a&gt;
                  &lt;/ul&gt;" tabindex="0">13</a>
          </span>
          <span class="badge-group">
            <a href="./index.html?q=proj4js" class="badge badge-info">proj4js</a><a
              class="badge badge-info tag-modal-toggle" data-bs-toggle="modal" data-bs-target="#tag-example-list"
              data-title="proj4js" data-content="&lt;ul class=&quot;list-group&quot;&gt;
                  &lt;li&gt;&lt;a class=&quot;list-group-item list-group-item-action&quot; href=&quot;./cog-projection.html&quot;&gt;COG with Projection Lookup&lt;/a&gt;
                  &lt;li&gt;&lt;a class=&quot;list-group-item list-group-item-action&quot; href=&quot;./reprojection-image.html&quot;&gt;Image Reprojection&lt;/a&gt;
                  &lt;li&gt;&lt;a class=&quot;list-group-item list-group-item-action&quot; href=&quot;./reprojection.html&quot;&gt;Raster Reprojection&lt;/a&gt;
                  &lt;li&gt;&lt;a class=&quot;list-group-item list-group-item-action active&quot; href=&quot;./reprojection-by-code.html&quot;&gt;Reprojection with EPSG.io Search&lt;/a&gt;
                  &lt;li&gt;&lt;a class=&quot;list-group-item list-group-item-action&quot; href=&quot;./wms-image-custom-proj.html&quot;&gt;Single Image WMS with Proj4js&lt;/a&gt;
                  &lt;li&gt;&lt;a class=&quot;list-group-item list-group-item-action&quot; href=&quot;./sphere-mollweide.html&quot;&gt;Sphere Mollweide&lt;/a&gt;
                  &lt;/ul&gt;" tabindex="0">6</a>
          </span>
          <span class="badge-group">
            <a href="./index.html?q=epsg.io" class="badge badge-info">epsg.io</a><a
              class="badge badge-info tag-modal-toggle" data-bs-toggle="modal" data-bs-target="#tag-example-list"
              data-title="epsg.io" data-content="&lt;ul class=&quot;list-group&quot;&gt;
                  &lt;li&gt;&lt;a class=&quot;list-group-item list-group-item-action active&quot; href=&quot;./reprojection-by-code.html&quot;&gt;Reprojection with EPSG.io Search&lt;/a&gt;
                  &lt;/ul&gt;" tabindex="0">1</a>
          </span>
          <span class="badge-group">
            <a href="./index.html?q=graticule" class="badge badge-info">graticule</a><a
              class="badge badge-info tag-modal-toggle" data-bs-toggle="modal" data-bs-target="#tag-example-list"
              data-title="graticule" data-content="&lt;ul class=&quot;list-group&quot;&gt;
                  &lt;li&gt;&lt;a class=&quot;list-group-item list-group-item-action&quot; href=&quot;./graticule.html&quot;&gt;Map Graticule&lt;/a&gt;
                  &lt;li&gt;&lt;a class=&quot;list-group-item list-group-item-action active&quot; href=&quot;./reprojection-by-code.html&quot;&gt;Reprojection with EPSG.io Search&lt;/a&gt;
                  &lt;li&gt;&lt;a class=&quot;list-group-item list-group-item-action&quot; href=&quot;./sphere-mollweide.html&quot;&gt;Sphere Mollweide&lt;/a&gt;
                  &lt;/ul&gt;" tabindex="0">3</a>
          </span>
        </p>
        <div class="modal modal-tag-example" id="tag-example-list" tabindex="-1" role="dialog"
          aria-labelledby="tag-example-title" aria-hidden="true">
          <div class="modal-dialog modal-dialog-scrollable" role="document">
            <div class="modal-content">
              <div class="modal-header">
                <h5 class="modal-title" id="tag-example-title"></h5>
                <button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
              </div>
              <div class="modal-body">
                <div class="list-group"></div>
              </div>
            </div>
          </div>
        </div>
        <div id="map" class="map"></div>
        <form class="row">
          <span class="col-auto">
            <span class="input-group">
              <label class="input-group-text" for="epsg-query">搜索投影：</label>
              <input type="text" id="epsg-query" placeholder="4326, 27700, 3031, US National Atlas, Swiss, France, ..."
                class="form-control" size="50" />
              <button class="btn btn-outline-secondary" id="epsg-search">Search</button>
            </span>
          </span>
          <span class="mt-2" id="epsg-result">&nbsp;</span>
        </form>
        <form>
          <div class="form-check mt-2">
            <input class="form-check-input" type="checkbox" id="render-edges" />
            <label class="form-check-label" for="render-edges">渲染重新投影边缘</label><br>
          </div>
          <div class="form-check">
            <input class="form-check-input" type="checkbox" id="show-tiles" />
            <label class="form-check-label" for="show-tiles">显示平铺坐标</label><br>
          </div>
          <div class="form-check">
            <input class="form-check-input" type="checkbox" id="show-graticule" />
            <label class="form-check-label" for="show-graticule">显示网格</label>
          </div>
        </form>

      </div>
      <form method="POST" id="codepen-form" target="_blank" action="https://codesandbox.io/api/v1/sandboxes/define">
        <input id="codesandbox-params" type="hidden" name="parameters">
      </form>
    </div>

    <div class="row-fluid">
      <div class="span12">
        <p id="shortdesc">演示OSM到任意投影的客户端光栅重投影</p>
        <div id="docs">
          <p>此示例显示了通过在<a href="https://epsg.io/">EPSG.io</a> 数据库中搜索从OSM（EPSG:3857）到任意投影的客户端光栅重投影功能。</p>
        </div>
      </div>
    </div>

    <div class="row-fluid">
      <h5 class="source-heading">main.js</h5>
      <pre><code id="example-js-source" class="language-js">import Graticule from &#x27;ol/layer/Graticule.js&#x27;;
import Map from &#x27;ol/Map.js&#x27;;
import OSM from &#x27;ol/source/OSM.js&#x27;;
import Stroke from &#x27;ol/style/Stroke.js&#x27;;
import TileDebug from &#x27;ol/source/TileDebug.js&#x27;;
import TileLayer from &#x27;ol/layer/Tile.js&#x27;;
import View from &#x27;ol/View.js&#x27;;
import proj4 from &#x27;proj4&#x27;;
import {applyTransform} from &#x27;ol/extent.js&#x27;;
import {get as getProjection, getTransform} from &#x27;ol/proj.js&#x27;;
import {register} from &#x27;ol/proj/proj4.js&#x27;;

const osmSource &#x3D; new OSM();

const debugLayer &#x3D; new TileLayer({
  source: new TileDebug({
    tileGrid: osmSource.getTileGrid(),
    projection: osmSource.getProjection(),
  }),
  visible: false,
});

const graticule &#x3D; new Graticule({
  // the style to use for the lines, optional.
  strokeStyle: new Stroke({
    color: &#x27;rgba(255,120,0,0.9)&#x27;,
    width: 2,
    lineDash: [0.5, 4],
  }),
  showLabels: true,
  visible: false,
  wrapX: false,
});

const map &#x3D; new Map({
  layers: [
    new TileLayer({
      source: osmSource,
    }),
    debugLayer,
    graticule,
  ],
  target: &#x27;map&#x27;,
  view: new View({
    projection: &#x27;EPSG:3857&#x27;,
    center: [0, 0],
    zoom: 1,
  }),
});

const queryInput &#x3D; document.getElementById(&#x27;epsg-query&#x27;);
const searchButton &#x3D; document.getElementById(&#x27;epsg-search&#x27;);
const resultSpan &#x3D; document.getElementById(&#x27;epsg-result&#x27;);
const renderEdgesCheckbox &#x3D; document.getElementById(&#x27;render-edges&#x27;);
const showTilesCheckbox &#x3D; document.getElementById(&#x27;show-tiles&#x27;);
const showGraticuleCheckbox &#x3D; document.getElementById(&#x27;show-graticule&#x27;);

function setProjection(code, name, proj4def, bbox) {
  if (code &#x3D;&#x3D;&#x3D; null || name &#x3D;&#x3D;&#x3D; null || proj4def &#x3D;&#x3D;&#x3D; null || bbox &#x3D;&#x3D;&#x3D; null) {
    resultSpan.innerHTML &#x3D; &#x27;Nothing usable found, using EPSG:3857...&#x27;;
    map.setView(
      new View({
        projection: &#x27;EPSG:3857&#x27;,
        center: [0, 0],
        zoom: 1,
      })
    );
    return;
  }

  resultSpan.innerHTML &#x3D; &#x27;(&#x27; + code + &#x27;) &#x27; + name;

  const newProjCode &#x3D; &#x27;EPSG:&#x27; + code;
  proj4.defs(newProjCode, proj4def);
  register(proj4);
  const newProj &#x3D; getProjection(newProjCode);
  const fromLonLat &#x3D; getTransform(&#x27;EPSG:4326&#x27;, newProj);

  let worldExtent &#x3D; [bbox[1], bbox[2], bbox[3], bbox[0]];
  newProj.setWorldExtent(worldExtent);

  // approximate calculation of projection extent,
  // checking if the world extent crosses the dateline
  if (bbox[1] &gt; bbox[3]) {
    worldExtent &#x3D; [bbox[1], bbox[2], bbox[3] + 360, bbox[0]];
  }
  const extent &#x3D; applyTransform(worldExtent, fromLonLat, undefined, 8);
  newProj.setExtent(extent);
  const newView &#x3D; new View({
    projection: newProj,
  });
  map.setView(newView);
  newView.fit(extent);
}

function search(query) {
  resultSpan.innerHTML &#x3D; &#x27;Searching ...&#x27;;
  fetch(&#x27;https://epsg.io/?format&#x3D;json&amp;q&#x3D;&#x27; + query)
    .then(function (response) {
      return response.json();
    })
    .then(function (json) {
      const results &#x3D; json[&#x27;results&#x27;];
      if (results &amp;&amp; results.length &gt; 0) {
        for (let i &#x3D; 0, ii &#x3D; results.length; i &lt; ii; i++) {
          const result &#x3D; results[i];
          if (result) {
            const code &#x3D; result[&#x27;code&#x27;];
            const name &#x3D; result[&#x27;name&#x27;];
            const proj4def &#x3D; result[&#x27;wkt&#x27;];
            const bbox &#x3D; result[&#x27;bbox&#x27;];
            if (
              code &amp;&amp;
              code.length &gt; 0 &amp;&amp;
              proj4def &amp;&amp;
              proj4def.length &gt; 0 &amp;&amp;
              bbox &amp;&amp;
              bbox.length &#x3D;&#x3D; 4
            ) {
              setProjection(code, name, proj4def, bbox);
              return;
            }
          }
        }
      }
      setProjection(null, null, null, null);
    });
}

/**
 * Handle click event.
 * @param {Event} event The event.
 */
searchButton.onclick &#x3D; function (event) {
  search(queryInput.value);
  event.preventDefault();
};

/**
 * Handle checkbox change events.
 */
function onReprojectionChange() {
  osmSource.setRenderReprojectionEdges(renderEdgesCheckbox.checked);
}
function onGraticuleChange() {
  graticule.setVisible(showGraticuleCheckbox.checked);
}
function onTilesChange() {
  debugLayer.setVisible(showTilesCheckbox.checked);
}
showGraticuleCheckbox.addEventListener(&#x27;change&#x27;, onGraticuleChange);
renderEdgesCheckbox.addEventListener(&#x27;change&#x27;, onReprojectionChange);
showTilesCheckbox.addEventListener(&#x27;change&#x27;, onTilesChange);

onReprojectionChange();
onGraticuleChange();
onTilesChange();
</code></pre>
    </div>

    <div class="row-fluid">
      <h5 class="source-heading">index.html</h5>
      <pre><code id="example-html-source" class="language-markup">&lt;!DOCTYPE html&gt;
&lt;html lang="en"&gt;
  &lt;head&gt;
    &lt;meta charset="UTF-8"&gt;
    &lt;title&gt;Reprojection with EPSG.io Search&lt;/title&gt;
    &lt;link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap@5.2.0/dist/css/bootstrap.min.css"&gt;
    &lt;link rel="stylesheet" href="node_modules/ol/ol.css"&gt;
    &lt;style&gt;
      .map {
        width: 100%;
        height: 400px;
      }
    &lt;/style&gt;
  &lt;/head&gt;
  &lt;body&gt;
    &lt;div id&#x3D;&quot;map&quot; class&#x3D;&quot;map&quot;&gt;&lt;/div&gt;
    &lt;form class&#x3D;&quot;row&quot;&gt;
      &lt;span class&#x3D;&quot;col-auto&quot;&gt;
        &lt;span class&#x3D;&quot;input-group&quot;&gt;
          &lt;label class&#x3D;&quot;input-group-text&quot; for&#x3D;&quot;epsg-query&quot;&gt;Search projection:&amp;nbsp&lt;/label&gt;
          &lt;input type&#x3D;&quot;text&quot; id&#x3D;&quot;epsg-query&quot; placeholder&#x3D;&quot;4326, 27700, 3031, US National Atlas, Swiss, France, ...&quot; class&#x3D;&quot;form-control&quot; size&#x3D;&quot;50&quot; /&gt;
          &lt;button class&#x3D;&quot;btn btn-outline-secondary&quot; id&#x3D;&quot;epsg-search&quot;&gt;Search&lt;/button&gt;
        &lt;/span&gt;
      &lt;/span&gt;
      &lt;span class&#x3D;&quot;mt-2&quot; id&#x3D;&quot;epsg-result&quot;&gt;&amp;nbsp;&lt;/span&gt;
    &lt;/form&gt;
    &lt;form&gt;
      &lt;div class&#x3D;&quot;form-check mt-2&quot;&gt;
        &lt;input class&#x3D;&quot;form-check-input&quot; type&#x3D;&quot;checkbox&quot; id&#x3D;&quot;render-edges&quot; /&gt;
        &lt;label class&#x3D;&quot;form-check-label&quot; for&#x3D;&quot;render-edges&quot;&gt;Render reprojection edges&lt;/label&gt;&lt;br&gt;
      &lt;/div&gt;
      &lt;div class&#x3D;&quot;form-check&quot;&gt;
        &lt;input class&#x3D;&quot;form-check-input&quot; type&#x3D;&quot;checkbox&quot; id&#x3D;&quot;show-tiles&quot; /&gt;
        &lt;label class&#x3D;&quot;form-check-label&quot; for&#x3D;&quot;show-tiles&quot;&gt;Show tile coordinates&lt;/label&gt;&lt;br&gt;
      &lt;/div&gt;
      &lt;div class&#x3D;&quot;form-check&quot;&gt;
        &lt;input class&#x3D;&quot;form-check-input&quot; type&#x3D;&quot;checkbox&quot; id&#x3D;&quot;show-graticule&quot; /&gt;
        &lt;label class&#x3D;&quot;form-check-label&quot; for&#x3D;&quot;show-graticule&quot;&gt;Show graticule&lt;/label&gt;
      &lt;/div&gt;
    &lt;/form&gt;

    &lt;script type="module" src="main.js"&gt;&lt;/script&gt;
  &lt;/body&gt;
&lt;/html&gt;</code></pre>
    </div>

    <div class="row-fluid">
      <h5 class="source-heading">package.json</h5>
      <pre><code id="example-pkg-source" class="language-json">{
  &quot;name&quot;: &quot;reprojection-by-code&quot;,
  &quot;dependencies&quot;: {
    &quot;ol&quot;: &quot;8.2.0&quot;,
    &quot;proj4&quot;: &quot;2.9.2&quot;
  },
  &quot;devDependencies&quot;: {
    &quot;vite&quot;: &quot;^3.2.3&quot;
  },
  &quot;scripts&quot;: {
    &quot;start&quot;: &quot;vite&quot;,
    &quot;build&quot;: &quot;vite build&quot;
  }
}</code></pre>
    </div>
  </div>

  <script src="https://cdn.jsdelivr.net/npm/bootstrap@5.2.0/dist/js/bootstrap.bundle.min.js"></script>
  <script src="common.js"></script>
  <script src="reprojection-by-code.js"></script>
  <script src="https://cdnjs.cloudflare.com/ajax/libs/prism/1.28.0/components/prism-core.min.js"></script>
  <script src="https://cdnjs.cloudflare.com/ajax/libs/prism/1.28.0/plugins/autoloader/prism-autoloader.min.js"></script>
  <script src="https://cdnjs.cloudflare.com/ajax/libs/prism/1.28.0/plugins/toolbar/prism-toolbar.min.js"></script>
  <script
    src="https://cdnjs.cloudflare.com/ajax/libs/prism/1.28.0/plugins/copy-to-clipboard/prism-copy-to-clipboard.js"></script>
  <script src="./resources/common.js"></script>
  <script>
    document.getElementById('tag-example-list')
      .addEventListener('show.bs.modal', function (event) {
        const button = event.relatedTarget; // Button that triggered the modal
        this.querySelector('.modal-title').innerText = button.dataset.title;
        this.querySelector('.modal-body').innerHTML = button.dataset.content;
      });
  </script>
  <script>
    const releaseUrl = 'https://cdn.jsdelivr.net/npm/ol/package.json';
    fetch(releaseUrl).then(function (response) {
      return response.json();
    }).then(function (json) {
      const latestVersion = json.version;
      document.getElementById('latest-version').innerHTML = latestVersion;
      const url = window.location.href;
      const branchSearch = url.match(/\/([^\/]*)\/examples\//);
      const storageKey = 'ol-dismissed=-' + latestVersion;
      const dismissed = localStorage.getItem(storageKey) === 'true';
      if (branchSearch && !dismissed && /^v[0-9\.]*$/.test(branchSearch[1]) && '8.2.0' != latestVersion) {
        const link = url.replace(branchSearch[0], '/latest/examples/');
        fetch(link, { method: 'head' }).then(function (response) {
          const a = document.getElementById('latest-link');
          a.href = response.status == 200 ? link : '../../latest/examples/';
        });
        const latestCheck = document.getElementById('latest-check');
        latestCheck.style.display = '';
        document.getElementById('latest-dismiss').onclick = function () {
          latestCheck.style.display = 'none';
          localStorage.setItem(storageKey, 'true');
        }
      }
    });
  </script>
</body>

</html>